﻿#region License
/* Copyright (C) 2009 Tim Coulter
 * 
 * This file is part of ExtremeML.
 * 
 * ExtremeML is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License, as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
*/
#endregion

using System.Drawing;

namespace ExtremeML.Packaging
{
	// This is a partial class that adds custom functionality to its auto-generated partner.
	public sealed partial class ImagePartWrapperCollection
	{
		#region Custom Properties


		#endregion
		#region Custom Methods

		/// <summary>
		/// Returns the wrapper for the image part having the specified relationship id.
		/// </summary>
		/// <param name="relationshipId">The relationship id associated with the target image part.</param>
		/// <returns>A <see cref="ImagePartWrapper"/> that matches the specified id. <c>null</c> if no match is found.</returns>
		public ImagePartWrapper Find(
			string relationshipId)
		{
			return Items.Find(item => item.Id == relationshipId);
		}

		/// <summary>
		/// Returns a <see cref="ImagePartWrapper"/> that wraps a new image part containing the passed image.
		/// </summary>
		/// <param name="image">A <see cref="Bitmap"/> to be stored in the new instance.</param>
		/// <returns>A new instance of <see cref="ImagePartWrapper"/>.</returns>
		public ImagePartWrapper Add(
			Bitmap image)
		{
			var result = Add(image.RawFormat);
			result.SetImage(image);
			result.Activate();
			return result;
		}

		#endregion
		#region Overrides


		#endregion
		#region Implementation Methods


		#endregion
		#region Static Methods


		#endregion
	}
}
